.class Lcom/waiqin365/lightapp/im/activity/n;
.super Ljava/lang/Object;

# interfaces
.implements Landroid/widget/AdapterView$OnItemClickListener;


# instance fields
.field final synthetic a:Lcom/waiqin365/lightapp/im/adapter/aq;

.field final synthetic b:Lcom/waiqin365/lightapp/im/activity/ChatActivity;


# direct methods
.method constructor <init>(Lcom/waiqin365/lightapp/im/activity/ChatActivity;Lcom/waiqin365/lightapp/im/adapter/aq;)V
    .locals 0

    iput-object p1, p0, Lcom/waiqin365/lightapp/im/activity/n;->b:Lcom/waiqin365/lightapp/im/activity/ChatActivity;

    iput-object p2, p0, Lcom/waiqin365/lightapp/im/activity/n;->a:Lcom/waiqin365/lightapp/im/adapter/aq;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public onItemClick(Landroid/widget/AdapterView;Landroid/view/View;IJ)V
    .locals 5

    const/4 v3, -0x1

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/activity/n;->a:Lcom/waiqin365/lightapp/im/adapter/aq;

    invoke-virtual {v0, p3}, Lcom/waiqin365/lightapp/im/adapter/aq;->getItem(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    :try_start_0
    iget-object v1, p0, Lcom/waiqin365/lightapp/im/activity/n;->b:Lcom/waiqin365/lightapp/im/activity/ChatActivity;

    invoke-static {v1}, Lcom/waiqin365/lightapp/im/activity/ChatActivity;->J(Lcom/waiqin365/lightapp/im/activity/ChatActivity;)Landroid/view/View;

    move-result-object v1

    invoke-virtual {v1}, Landroid/view/View;->getVisibility()I

    move-result v1

    if-eqz v1, :cond_0

    const-string/jumbo v1, "im_delete_expression"

    if-eq v0, v1, :cond_1

    const-string/jumbo v1, "com.waiqin365.lightapp.im.utils.SmileUtils"

    invoke-static {v1}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/lang/Class;->getField(Ljava/lang/String;)Ljava/lang/reflect/Field;

    move-result-object v0

    sget-object v1, Lcom/waiqin365/lightapp/im/activity/ChatActivity;->b:Lcom/waiqin365/lightapp/im/widget/PasteEditText;

    invoke-virtual {v1}, Lcom/waiqin365/lightapp/im/widget/PasteEditText;->getText()Landroid/text/Editable;

    move-result-object v1

    sget-object v2, Lcom/waiqin365/lightapp/im/activity/ChatActivity;->b:Lcom/waiqin365/lightapp/im/widget/PasteEditText;

    invoke-virtual {v2}, Lcom/waiqin365/lightapp/im/widget/PasteEditText;->getSelectionStart()I

    move-result v2

    iget-object v3, p0, Lcom/waiqin365/lightapp/im/activity/n;->b:Lcom/waiqin365/lightapp/im/activity/ChatActivity;

    const/4 v4, 0x0

    invoke-virtual {v0, v4}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    const v4, 0x3f333333    # 0.7f

    invoke-static {v3, v0, v4}, Lcom/waiqin365/lightapp/im/utils/SmileUtils;->getSmiledText(Landroid/content/Context;Ljava/lang/CharSequence;F)Landroid/text/Spannable;

    move-result-object v0

    invoke-interface {v1, v2, v0}, Landroid/text/Editable;->insert(ILjava/lang/CharSequence;)Landroid/text/Editable;

    :cond_0
    :goto_0
    return-void

    :cond_1
    sget-object v0, Lcom/waiqin365/lightapp/im/activity/ChatActivity;->b:Lcom/waiqin365/lightapp/im/widget/PasteEditText;

    invoke-virtual {v0}, Lcom/waiqin365/lightapp/im/widget/PasteEditText;->getText()Landroid/text/Editable;

    move-result-object v0

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_0

    sget-object v0, Lcom/waiqin365/lightapp/im/activity/ChatActivity;->b:Lcom/waiqin365/lightapp/im/widget/PasteEditText;

    invoke-virtual {v0}, Lcom/waiqin365/lightapp/im/widget/PasteEditText;->getSelectionStart()I

    move-result v0

    if-lez v0, :cond_0

    sget-object v1, Lcom/waiqin365/lightapp/im/activity/ChatActivity;->b:Lcom/waiqin365/lightapp/im/widget/PasteEditText;

    invoke-virtual {v1}, Lcom/waiqin365/lightapp/im/widget/PasteEditText;->getText()Landroid/text/Editable;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v1

    const/4 v2, 0x0

    invoke-virtual {v1, v2, v0}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v1

    const-string/jumbo v2, "[em]"

    invoke-virtual {v1, v2}, Ljava/lang/String;->lastIndexOf(Ljava/lang/String;)I

    move-result v2

    if-eq v2, v3, :cond_3

    invoke-virtual {v1, v2, v0}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v1

    invoke-interface {v1}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lcom/waiqin365/lightapp/im/utils/SmileUtils;->containsKey(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_2

    sget-object v1, Lcom/waiqin365/lightapp/im/activity/ChatActivity;->b:Lcom/waiqin365/lightapp/im/widget/PasteEditText;

    invoke-virtual {v1}, Lcom/waiqin365/lightapp/im/widget/PasteEditText;->getEditableText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1, v2, v0}, Landroid/text/Editable;->delete(II)Landroid/text/Editable;

    goto :goto_0

    :catch_0
    move-exception v0

    goto :goto_0

    :cond_2
    sget-object v1, Lcom/waiqin365/lightapp/im/activity/ChatActivity;->b:Lcom/waiqin365/lightapp/im/widget/PasteEditText;

    invoke-virtual {v1}, Lcom/waiqin365/lightapp/im/widget/PasteEditText;->getEditableText()Landroid/text/Editable;

    move-result-object v1

    add-int/lit8 v2, v0, -0x1

    invoke-interface {v1, v2, v0}, Landroid/text/Editable;->delete(II)Landroid/text/Editable;

    goto :goto_0

    :cond_3
    const-string/jumbo v2, " "

    invoke-virtual {v1, v2}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z

    move-result v2

    if-eqz v2, :cond_5

    const-string/jumbo v2, "@"

    invoke-virtual {v1, v2}, Ljava/lang/String;->lastIndexOf(Ljava/lang/String;)I

    move-result v2

    if-eq v2, v3, :cond_0

    invoke-virtual {v1, v2, v0}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v1

    const/4 v3, 0x0

    invoke-virtual {v1}, Ljava/lang/String;->length()I

    move-result v4

    add-int/lit8 v4, v4, -0x1

    invoke-virtual {v1, v3, v4}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v1

    const-string/jumbo v3, " "

    invoke-virtual {v1, v3}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v1

    if-nez v1, :cond_4

    sget-object v1, Lcom/waiqin365/lightapp/im/activity/ChatActivity;->b:Lcom/waiqin365/lightapp/im/widget/PasteEditText;

    invoke-virtual {v1}, Lcom/waiqin365/lightapp/im/widget/PasteEditText;->getEditableText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1, v2, v0}, Landroid/text/Editable;->delete(II)Landroid/text/Editable;

    goto/16 :goto_0

    :cond_4
    sget-object v1, Lcom/waiqin365/lightapp/im/activity/ChatActivity;->b:Lcom/waiqin365/lightapp/im/widget/PasteEditText;

    invoke-virtual {v1}, Lcom/waiqin365/lightapp/im/widget/PasteEditText;->getEditableText()Landroid/text/Editable;

    move-result-object v1

    add-int/lit8 v2, v0, -0x1

    invoke-interface {v1, v2, v0}, Landroid/text/Editable;->delete(II)Landroid/text/Editable;

    goto/16 :goto_0

    :cond_5
    sget-object v1, Lcom/waiqin365/lightapp/im/activity/ChatActivity;->b:Lcom/waiqin365/lightapp/im/widget/PasteEditText;

    invoke-virtual {v1}, Lcom/waiqin365/lightapp/im/widget/PasteEditText;->getEditableText()Landroid/text/Editable;

    move-result-object v1

    add-int/lit8 v2, v0, -0x1

    invoke-interface {v1, v2, v0}, Landroid/text/Editable;->delete(II)Landroid/text/Editable;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto/16 :goto_0
.end method
